﻿using System;
using System.Windows.Forms;

namespace MarioMapEditor
{
    public partial class FormBrickSP : Form
    {
        private readonly MainForm _mParent;
        private readonly int _selectedID;
        private int _info;

        public FormBrickSP(MainForm mparent, int selected)
        {
            _mParent = mparent;
            _selectedID = selected;
            _info = 0;
            InitializeComponent();
            comboBox1.SelectedIndex = 0;
        }

        private void CheckBox1CheckedChanged(object sender, EventArgs e)
        {
            comboBox1.Enabled = checkBox1.Checked;
        }

        private void Button1Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                switch (comboBox1.SelectedIndex)
                {
                    case 0:
                        _info = (int)ObBrickSP.INFO.NAM;
                        break;
                    case 1:
                        _info = (int)ObBrickSP.INFO.HOA;
                        break;
                    case 2:
                        _info = (int)ObBrickSP.INFO.SAO;
                        break;
                    case 3:
                        _info = (int)ObBrickSP.INFO.NAMHOA;
                        break;
                    case 4:
                        _info = (int)ObBrickSP.INFO.TIEN;
                        break;
                    case 5:
                        _info = (int)ObBrickSP.INFO.TIEN10;
                        break;
                    case 6:
                        _info = (int)ObBrickSP.INFO.TIEN12;
                        break;
                    case 7:
                        _info = (int)ObBrickSP.INFO.TIEN20;
                        break;
                    case 8:
                        _info = (int)ObBrickSP.INFO.NAMLV;
                        break;
                    default:
                        _info = 0;
                        break;
                }
            }
            _mParent.CreateBrickSp(_selectedID, _info);
            Close();
        }


    }
}
